package com.zzyl.nursing.controller;

import com.zzyl.common.annotation.Log;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.common.enums.BusinessType;
import com.zzyl.common.utils.poi.ExcelUtil;
import com.zzyl.nursing.domain.AlertRule;
import com.zzyl.nursing.dto.AlertDataHandleDto;
import com.zzyl.nursing.dto.AlertDataPageQueryDto;
import com.zzyl.nursing.service.IAlertDataService;
import com.zzyl.nursing.service.IAlertRuleService;
import com.zzyl.nursing.vo.AlertDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


@RestController
@RequestMapping("/nursing/alertData")
public class AlertDataController extends BaseController{


    @Autowired
    private IAlertDataService iAlertDataService;

    //分页查询报警数据
    @ApiOperation("分页查询报警数据")
    @GetMapping("/list")
    public TableDataInfo<AlertDataVo> getAlertData(AlertDataPageQueryDto alertDataPageQueryDto){
        startPage();
        List<AlertDataVo> list =  iAlertDataService.getAlertData(alertDataPageQueryDto);
        return getDataTable(list);
    }

    //处理设备报警数据
    @ApiOperation("处理设备报警数据")
    @PutMapping("/handleAlertData")
    public AjaxResult processHandleAlertData(@ApiParam(value = "报警规则实体")@RequestBody AlertDataHandleDto alertDataHandleDto){
        iAlertDataService.processHandleAlertData(alertDataHandleDto);
        return success();
    }

}
